using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;

namespace mdv.wssSchemaExplorer.WSS
{
    public class wssContentTypesController : IController
    {
        public wssContentTypesController(wssContentTypes contentTypes)
        {
            _actions = new ContextMenu();
            _actions.MenuItems.Add(new MenuItem("Add ContentType"));
            _actions.MenuItems.Add(new MenuItem("Add ContentTypeRef"));
            _contentTypes = contentTypes;
            if (null != _contentTypes.ContentTypes)
                foreach (wssContentType ct in _contentTypes.ContentTypes) _children.Add(new wssContentTypeController(ct));
            if (null != _contentTypes.ContentTypeRefs)
                foreach (wssContentTypeRef ctr in _contentTypes.ContentTypeRefs) _children.Add(new wssContentTypeRefController(ctr));
        }
        public override string ToString()
        {
            return _contentTypes.ToString();
        }
        #region IController Members
        private List<IController> _children = new List<IController>();
        [Browsable(false)]
        public List<IController> Children
        {
            get { return _children; }
        }
        private ContextMenu _actions;
        [Browsable(false)]
        public ContextMenu Actions
        {
            get { return _actions; }
        }
        private wssContentTypes _contentTypes = null;
        [Browsable(false)]
        public object Model
        {
            get { return _contentTypes; }
        }
        #endregion
    }
}